﻿using WH.Model.Bases;
using WH.Common.Bases.IBase;
using SqlSugar;

namespace WH.Model.Systems
{
    ///<summary>
    ///角色信息表
    ///</summary>
    [SugarTable("sys_role")]
    public class RoleEntity : BaseOrgAuditableEntity, IOrganizationFilter
    {
        /// <summary>
        /// 角色/岗位编号 例如 manager
        /// </summary>           
        [SugarColumn(ColumnName = "code", IsNullable = false, Length = 50, ColumnDescription = "角色/岗位编号")]
        public string Code { get; set; } = null!;

        /// <summary>
        /// 角色/岗位名称 例如 经理
        /// </summary>           
        [SugarColumn(ColumnName = "name", IsNullable = false, Length = 50, ColumnDescription = "角色/岗位名称")]
        public string Name { get; set; } = null!;

        /// <summary>
        /// 描述
        /// </summary>           
        [SugarColumn(ColumnName = "description", IsNullable = true, Length = 50, ColumnDescription = "角色描述")]
        public string? Description { get; set; }

        /// <summary>
        /// 角色类型
        /// </summary>           
        [SugarColumn(ColumnName = "type_code", IsNullable = false, Length = 50, ColumnDescription = "角色类型")]
        public string TypeCode { get; set; } = null!;

        /// <summary>
        /// 类型
        /// </summary>
        [Navigate(NavigateType.OneToOne, nameof(TypeCode), nameof(KeyValueEntity.Code))]
        public KeyValueEntity? RoleType { get; set; }

        /// <summary>
        /// 排序码 数字越小越靠前
        /// </summary>           
        [SugarColumn(ColumnName = "sort_code", IsNullable = true, Length = 11, ColumnDescription = "排序码")]
        public int SortCode { get; set; }

        /// <summary>
        /// 状态（0停用 1正常）
        /// </summary>           
        [SugarColumn(ColumnName = "is_enable", IsNullable = true, Length = 1, ColumnDescription = "状态（0停用 1正常）")]
        public bool IsEnable { get; set; }

        ///// <summary>
        ///// 角色/岗位编号 例如 manager
        ///// </summary>           
        //[SugarColumn(ColumnName = "type", IsNullable = true, Length = 11, ColumnDescription = "角色/岗位编号")]
        //public RoleTypeEnum Type { get; set; } = RoleTypeEnum.User;

        /// <summary>
        /// 描述/备注说明
        /// </summary>           
        [SugarColumn(ColumnName = "remark", IsNullable = true, Length = 255, ColumnDescription = "描述/备注说明")]
        public string? Remark { get; set; }

        /// <summary>
        /// 机构id
        /// </summary>           
        [SugarColumn(ColumnName = "organization_id", IsNullable = false, Length = 50, ColumnDescription = "机构id")]
        public override string OrganizationId { get; set; } = null!;

    }
}
